package concurrent;

import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author Summerday
 */
public class TestScheduledThreadPool {

    private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

    public static void main (String[] args) throws InterruptedException {
        scheduler.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run () {
                System.out.println("command .. " + new Date());
            }
        }, 0, 1, TimeUnit.SECONDS);
    }
}
